package com.zsck.zsgy.ui.main.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.zsck.zsgy.ui.main.fragment.FindHouseFragment
import com.zsck.zsgy.ui.main.fragment.HomeFragment
import com.zsck.zsgy.ui.main.fragment.MineFragment
import com.zsck.zsgy.ui.main.fragment.SimpleCircleFragment
import com.zsck.zsgy.util.Constants

class NavPagerAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {


    override fun getItemCount(): Int {
        return Constants.navName?.size!!

    }

    override fun createFragment(position: Int): Fragment {
        when (position) {
            0 -> return HomeFragment.newInstance()
            1 -> return FindHouseFragment.newInstance()
            2 -> return SimpleCircleFragment.newInstance()
            else -> return MineFragment.newInstance()

        }
    }
}